home *** CD-ROM | disk | FTP | other *** search
/ Inventor Labs: Technology / INVENTORLABS_TECHNOLOGY.BIN / mac / FILES / SHARED.CST / 00021_Script_Interface Mgr Parent < prev    next >
Text File  |  1997-07-24  |  26KB  |  712 lines

  1. --o:  Interface Mgr
  2.  
  3. -- gInterfaceMgrObj
  4.  
  5. property pRollOverHiliteSprite, pActiveHiliteSprite, pToolWindowSprite, pToolWinHiliteSprite
  6. property pToolHiliteSprite
  7. property pNumOfButtons
  8.  
  9. property pToolBtnGrpRect, pGlobalBtnGrpRect, pToolBtnWidth, pToolMenuRect
  10. property pToolBtnSegWidth, pGlobalBtnWidth, pGlobalBtnSegWidth
  11. property pToolBtnGrpLeft, pGlobalBtnGrpLeft, pFirstHiliteBtn, pToolBtnRelFirstCast, pGlobalBtnRelFirstCast
  12. property pWhichBtnOver
  13.  
  14. property pToolObjectList, pGlobalBtnTargetList
  15. property pLabelTxtCast, pDescriptionTxtCast, pInstructionTxtCast
  16. property pActiveTool, pCastList, pAvailableBtnList
  17. property pLabelSprite, pDescriptionSprite, pInstructionSprite
  18. property pLabelLocH, pDescriptionLocH, pInstructionLocH
  19. property pQTVRmovieList, pCurrentQTVR, pFirstInventorBtn, pCurrentInventor, pTitleSprite
  20. property pFirstAnimTool, pFirstToolOn, pFirstTitle, pFirstToolOff, pAnimBtnCount
  21. property pRotateSprite, pToolCount, pSuspendedTool, pFirstGlobalBtnOn, pGlobalBtnOnSprite
  22. property pSpritePlaceMem
  23.  
  24. property pToolRects, pButtonSnd
  25. property pToolMenus, pToolsActive
  26. property pGalleryVOsnd, pPictSprite
  27. -- objects
  28.  
  29. property  pQTVRobj, pHSobjIndexedLst, pCurrentHStext, pInvenFilenameLst, pInvHsObjLst
  30. property pInitialQTVRcords,pInitialQTVRlst,pInventorIndexLst 
  31.  
  32. property pActive, pActiveFunctionalty, pUnAvailToolStartCast
  33.  
  34. global gModeManager, gAreaManagerObj
  35. global gWHSobjIndexedLst, gBHSobjIndexedLst, gEHSobjIndexedLst, gGHSobjIndexedLst
  36. global gInventorIndexNum, gJournalObj
  37. global gActorListMgrObj, gSndPath
  38. global gActiveAmbSnd, gActiveInvObj
  39.  
  40. global gQTVRobj, gActiveFunctionObj, gHelpFrame, gUtilityObj,gAvailbleInv
  41. ----------------------------------------------------------------------------ò
  42. on mInit me, CastList, QTpath
  43.   
  44.   set pCastList = CastList
  45.   set pSpritePlaceMem = member "Sprite Placeholder"
  46.   
  47.   -- sprite declarations
  48.   
  49.   
  50.   set QTVRsprite = 2
  51.   set pPictSprite = 18
  52.   set pRotateSprite = 26
  53.   set pGlobalBtnOnSprite = 38
  54.   set pActiveHiliteSprite = 39
  55.   set pToolWindowSprite = 40
  56.   set pToolWinHiliteSprite = 41
  57.   set pTitleSprite = 42
  58.   set pRollOverHiliteSprite = 43
  59.   set pLabelSprite = 44
  60.   set pDescriptionSprite = 45
  61.   set pInstructionSprite = 46
  62.   
  63.   set pCurrentHStext = 0
  64.   set pWhichBtnOver = 1
  65.   -- cast declarations
  66.   set pFirstHiliteBtn = getaProp(pCastList,#pFirstHiliteBtn)
  67.   set pLabelTxtCast = getaProp(pCastList,#pLabelTxtCast)
  68.   set pDescriptionTxtCast = getaProp(pCastList,#pDescriptionTxtCast)
  69.   set pInstructionTxtCast = getaProp(pCastList,#pInstructionTxtCast)
  70.   set pFirstToolOff = getaProp(pCastList,#pFirstToolOff)  -- ROTATEoff
  71.   set pFirstTitle = getaProp(pCastList,#pFirstTitle)
  72.   set pFirstToolOn = getaProp(pCastList,#pFirstToolOn)
  73.   set pFirstAnimTool = getaProp(pCastList,#pFirstAnimTool)
  74.   set pFirstGlobalBtnOn = getaProp(pCastList,#pFirstGlobalBtnOn)
  75.   MoveBar( 5 )
  76.   
  77.   -- constants
  78.   set pActorListMgr = gActorListMgrObj
  79.   set pNumOfButtons = 5
  80.   set pToolBtnRelFirstCast = 1
  81.   set pGlobalBtnRelFirstCast = 7
  82.   set pFirstInventorBtn = 10
  83.   set pAnimBtnCount = 9
  84.   set pUnAvailToolStartCast = the number of cast "TIALLRWNA.PIC"
  85.   
  86.   set pActive = FALSE
  87.   repeat with btnCounter = 1 to pNumOfButtons
  88.     set firstCast = the number of cast pFirstAnimTool + (btnCounter - 1) * pAnimBtnCount
  89.     
  90.     repeat with animCounter = 0 to pAnimBtnCount - 1
  91.       set whichCast = firstCast + animCounter
  92.       preLoadCast whichCast
  93.     end repeat
  94.   end repeat
  95.   
  96.   -- init lists
  97.   set pAvailableBtnList = [#rotate:0,#operate:0,#zoom:0,#reveal:0,#load:0]
  98.   set pToolObjectList = [#rotate:0,#operate:0,#zoom:0,#reveal:0,#load:0]
  99.   set pQTVRmovieList = [#Bell:"BQTVR.MOV",#Edison:"EQTVR.MOV",#Watt:"WQTVR.MOV",#Gallery: "GSQTVR.MOV"]
  100.   
  101.   -- birth objects
  102.   -- tool buttons
  103.   set pToolCount = 5
  104.   set firstToolObject = getaProp(pCastList,#firstToolObject)  -- get scripts via compiled interger
  105.   MoveBar( 5 )
  106.   
  107.   repeat with toolBtn = 0 to pToolCount - 1
  108.     set whichScript = the name of cast (firstToolObject + toolBtn)
  109.     setAt (pToolObjectList, (toolBtn + 1),mInit (script whichScript))
  110.   end repeat
  111.   
  112.   set pToolRects = value(the text of cast "ToolRects")
  113.   set pToolMenus = value(the text of cast "ToolMenuCast")
  114.   
  115.   -- Mac or PC QTVR object
  116.   -- if the machinetype = 256 then  set pQTVRobj = mInit ( script"PCqtvr Parent",QTVRsprite, QTpath)
  117.   --else 
  118.   
  119.   set pQTVRobj = mInit ( script"MacQTVRParent",QTVRsprite, QTpath, me)
  120.   
  121.   set pInvenFilenameLst =   [#Edison:"Edison.Dir", #Watt:"Watt.Dir", #Bell:"Bell.Dir", #Gallery:"Gallery.Dir"]
  122.   set pInitialQTVRlst = ¼
  123.            [#Edison:"187.25,-2.1,54.5",#Watt:"10.3,-4.5,62",#Bell:"170.2,-5.9,47", #Gallery:"5.358, 0.201, 60.0"]
  124.   set pInvHsObjLst = ¼
  125.          [#Edison:gEHSobjIndexedLst, #Watt:gWHSobjIndexedLst, #Bell:gBHSobjIndexedLst, #Gallery:gGHSobjIndexedLst]
  126.   set pInventorIndexLst = [#Edison,#Watt,#Bell,#Gallery]
  127.   MoveBar( 5 )
  128.   
  129.   set gQTVRobj = pQTVRobj
  130.   set pActiveTool = EMPTY
  131.   
  132.   set the textHeight of field  pLabelTxtCast = 12
  133.   set the textHeight of field  pDescriptionTxtCast = 11
  134.   set the textHeight of field  pInstructionTxtCast = 11
  135.   
  136.   set gEdisonFilmed = FALSE
  137.   set gHelpFrame = empty
  138.   MoveBar( 5 )
  139.   set pToolsActive = TRUE
  140.   set pButtonSnd = the number of cast "GlobButn.aif"
  141.   set pGalleryVOsnd = #none
  142.   
  143.   mAddToActorlist (gActorListMgrObj, me)
  144.   
  145.   return( me )
  146.   
  147. end mInit
  148. ----------------------------------------------------------------------------ò
  149. on mSetUp me               -- to be used when in first frame of use
  150.   
  151.   -- constants
  152.   --main interface button info
  153.   set pToolBtnGrpRect = the rect of sprite 32
  154.   set pGlobalBtnGrpRect = the rect of sprite 35
  155.   set pToolBtnWidth = 45
  156.   set toolBtnGapWidth = 9
  157.   set pGlobalBtnWidth = 48
  158.   set globalBtnGapWidth = 12
  159.   set pToolBtnSegWidth = pToolBtnWidth + toolBtnGapWidth
  160.   
  161.   set pGlobalBtnSegWidth = pGlobalBtnWidth + globalBtnGapWidth
  162.   set pToolBtnGrpLeft = the left of pToolBtnGrpRect
  163.   set pGlobalBtnGrpLeft = the left of pGlobalBtnGrpRect
  164.   -- text fields
  165.   set pLabelLocH = the locH of sprite pLabelSprite
  166.   set pDescriptionLocH = the locH of sprite pDescriptionSprite
  167.   set pInstructionLocH = the locH of sprite pInstructionSprite
  168.   
  169.   
  170.   -- set object  properties
  171.   -- tool buttons
  172.   set firstToolObject = getaProp(pCastList,#firstToolObject)
  173.   set firstToolMenu = getaProp(pCastList,#firstToolMenu)
  174.   
  175.   set pToolMenuRects = value( the text of cast "ToolRects" )
  176.   set toolBtn = 0
  177.   MoveBar( 5 )
  178.   repeat with whichtool in pToolObjectList
  179.     set whichMenuCast = firstToolMenu + (toolBtn)
  180.     set toolBtn = toolBtn + 1
  181.     mSetup (whichtool)
  182.   end repeat
  183.   
  184.   mClearText me
  185.   set pSuspendedTool = EMPTY
  186.   
  187. end
  188. ----------------------------------------------------------------------------ò
  189. on mActivate me, toolsActive                                      -- used to activate puppets and cursors
  190.   
  191.   -- puppets     
  192.   
  193.   puppetsprite pRollOverHiliteSprite, TRUE
  194.   --puppetsprite pActiveHiliteSprite, TRUE
  195.   puppetsprite pToolWindowSprite, TRUE
  196.   puppetsprite pToolWinHiliteSprite, TRUE
  197.   puppetSprite pGlobalBtnOnSprite, TRUE
  198.   puppetsprite pToolHiliteSprite, TRUE
  199.   
  200.   repeat with toolCounter = 0 to pToolCount - 1
  201.     puppetSprite (pRotateSprite + toolCounter), true
  202.   end repeat
  203.   
  204.   --set the castNum of sprite pTitleSprite = pFirstTitle + findPos(pQTVRmovieList,pCurrentInventor) - 1
  205.   
  206.   set pCurrentQTVR = getaProp( pQTVRmovieList, pCurrentInventor)
  207.   mSetToolBtns (me,#NONE, me)
  208.   if integerp( toolsActive ) then set pToolsActive = toolsActive
  209.   
  210.   set pWhichBtnOver  = #none 
  211.   set pActive = TRUE
  212.   
  213. end
  214.  
  215. ----------------------------------------------------------------------------ò
  216. on mDeactivate me
  217.   
  218.   mClearMyPuppets me
  219.   mSetToolBtns (me, #NONE, me)
  220.   mDeleteFromActorlist (pActorListMgr, me)
  221.   mHideQTVR( me )
  222.   
  223. end 
  224. ----------------------------------------------------------------------------ò
  225. on mClearMyPuppets me
  226.   
  227.   --  set puppets to false    
  228.   puppetsprite pRollOverHiliteSprite, FALSE
  229.   --puppetsprite pActiveHiliteSprite, FALSE
  230.   puppetsprite pToolWindowSprite, FALSE
  231.   puppetsprite pToolWinHiliteSprite, FALSE
  232.   puppetSprite pGlobalBtnOnSprite, FALSE
  233.   puppetSprite pTitleSprite, FALSE
  234.   repeat with toolCounter = 0 to pToolCount - 1
  235.     puppetSprite (pRotateSprite + toolCounter), FALSE
  236.   end repeat
  237.   
  238. end
  239. ----------------------------------------------------------------------------ò
  240. on mGoToLab me
  241.   
  242.   if (pWhichBtnOver = pFirstInventorBtn) then go frame "BVRFrame"
  243.   else if (pWhichBtnOver = pFirstInventorBtn + 1) then go frame "EVRFrame"
  244.   else if (pWhichBtnOver = pFirstInventorBtn + 2) then go frame "WVRFrame"
  245.   
  246. end
  247. ----------------------------------------------------------------------------ò
  248. -- tool list management
  249. ----------------------------------------------------------------------------ò
  250. on mSetToolBtns me, ActiveFunctionalty, ActiveFunctionObj                         -- controls which tool buttons are available
  251.   
  252.   set pActiveFunctionalty = ActiveFunctionalty
  253.   if (pActiveFunctionalty <> #None) then
  254.     
  255.     set pAvailableBtnList = [#rotate:0,#operate:0,#zoom:0,#reveal:0,#load:0]
  256.     set pAvailToolWinMenus = getaprop(pToolMenus,ActiveFunctionalty)  --returns #QTVR:[#rotate...ect
  257.     
  258.     set pAvailToolRects = getaprop(pToolRects,ActiveFunctionalty)
  259.     set numofAvailTools = count(pAvailToolWinMenus)
  260.     
  261.     repeat with toolCounter = 1 to numofAvailTools
  262.       set tooltocheck = getpropat(pAvailToolWinMenus,toolCounter)
  263.       setprop(pAvailableBtnList, tooltocheck, 1)
  264.       set menuCast = the number of cast getaprop( pAvailToolWinMenus, tooltocheck)
  265.       set menuRects = getaprop( pAvailToolRects, tooltocheck)
  266.       set toolObj = getaprop (pToolObjectList, tooltocheck)
  267.       mSetMenuProp( toolObj, menuCast,menuRects,pToolWinHiliteSprite,ActiveFunctionalty)
  268.     end repeat
  269.     
  270.     set gActiveFunctionObj = ActiveFunctionObj
  271.     
  272.   else set pAvailableBtnList = [#rotate:0,#operate:0,#zoom:0,#reveal:0,#load:0]
  273.   updatestage
  274.   
  275. end mSetToolBtns
  276. ----------------------------------------------------------------------------ò
  277. on mClearToolHilite me
  278.   
  279.   set the member of sprite pToolWinHiliteSprite = pSpritePlaceMem
  280.   
  281. end
  282. ----------------------------------------------------------------------------ò
  283. on mTurnToolMenuOff me
  284.   
  285.   repeat with toolCounter = 1 to 6
  286.     set the castNum of sprite (pRotateSprite + (toolCounter - 1)) = pFirstToolOff + (toolCounter - 1)
  287.   end repeat
  288.   
  289. end mTurnToolMenuOff
  290. ----------------------------------------------------------------------------ò
  291. on mClearToolMenu me
  292.   
  293.   set the member of sprite pToolWinHiliteSprite = pSpritePlaceMem
  294.   set the member of sprite pToolWindowSprite = pSpritePlaceMem
  295.   updatestage
  296.   
  297. end mClearToolMenu
  298. ----------------------------------------------------------------------------ò
  299. on mActivateTool me, whichBtn
  300.   
  301.   mReinstateTool (me)                                            -- reinstate previously active tool if any
  302.   mTurnOffTool (me)
  303.   set whatsnd = (the number of cast "Rotate.aif" + whichBtn -1 ) 
  304.   mPlaySndEffect (gUtilityObj, whatsnd) 
  305.   set firstCast = the number of member (pFirstAnimTool + (whichBtn - 1) * pAnimBtnCount)
  306.   
  307.   set pActive = false
  308.   repeat with animCounter = 0 to pAnimBtnCount - 1
  309.     set the member of sprite pRollOverHiliteSprite = member (firstCast + animCounter) 
  310.     updatestage
  311.     mDelay (me, 5)
  312.   end repeat
  313.   
  314.   set the castNum of sprite pRotateSprite + (whichBtn - 1) = pFirstToolOn + (whichBtn - 1) 
  315.   updatestage
  316.   
  317.   set pActiveTool = getAt (pToolObjectList, pWhichBtnOver)
  318.   set the castNum of sprite pToolWindowSprite =  mGetToolMenuCast (pActiveTool)
  319.   updateStage
  320.   set pActive = true
  321.   
  322. end
  323. ----------------------------------------------------------------------------ò
  324. on mSuspendTool me, whichTool                                 --  holds active tool in suspension; prevents roll-over
  325.   
  326.   set pSuspendedTool = whichTool
  327.   setAt (pAvailableBtnList, pSuspendedTool, 0)
  328.   
  329. end
  330. ----------------------------------------------------------------------------ò
  331. on mReinstateTool me                                                -- puts tool back in active list; allows roll-over
  332.   
  333.   if (pSuspendedTool <> EMPTY) then setAt (pAvailableBtnList, pSuspendedTool, 1)
  334.   set pSuspendedTool = EMPTY
  335.   
  336. end
  337. ----------------------------------------------------------------------------ò
  338. on mPerform me
  339.   
  340.   
  341.   if pActive then
  342.     
  343.     -- get mouse location
  344.     set mouseLocV = the mouseV
  345.     set mouseLocH = the mouseH
  346.     set mousePoint = point(mouseLocH, mouseLocV)
  347.     
  348.     -- check if over button rects; which one
  349.     if (inside(mousePoint, pToolBtnGrpRect)) and (pToolsActive) then mChkBtnHilites ¼
  350.                 (me, mouseLocH, pToolBtnRelFirstCast, pToolBtnGrpLeft, pToolBtnSegWidth, pToolBtnWidth)
  351.     else if (inside(mousePoint, pGlobalBtnGrpRect)) then 
  352.       mChkBtnHilites ¼
  353.                  (me, mouseLocH, pGlobalBtnRelFirstCast, pGlobalBtnGrpLeft, pGlobalBtnSegWidth, pGlobalBtnWidth)
  354.     else 
  355.       set the castNum of sprite pRollOverHiliteSprite = pSpritePlaceMem
  356.       if (pWhichBtnOver <> #none)  and  (pWhichBtnOver < 7 )   then set the castNum of sprite (pRotateSprite + (pWhichBtnOver - 1)) = pSpritePlaceMem
  357.     end if
  358.     
  359.   end if
  360.   
  361. end 
  362. ----------------------------------------------------------------------------ò
  363. on mChkBtnHilites me, mouseLocH, startCastFactor, btnGrpLeft, segmentWidth, btnWidth
  364.   
  365.   -- determine if over button
  366.   if ((mouseLocH - btnGrpLeft) mod segmentWidth < btnWidth ) then
  367.     set buttonSegment = startCastFactor + ((mouseLocH - btnGrpLeft) / segmentWidth)
  368.     if (buttonSegment = 6 ) then exit
  369.     
  370.     if (buttonSegment >= 7 ) then 
  371.       set the castnum of sprite pRollOverHiliteSprite =  (pFirstHiliteBtn + buttonSegment) -1
  372.     else 
  373.       
  374.       if (pWhichBtnOver <> #none) then
  375.         set the castNum of sprite (pRotateSprite + (pWhichBtnOver - 1)) = pFirstAnimTool + ((pWhichBtnOver - 1) * 9)
  376.       end if
  377.       if getat(pAvailableBtnList, buttonSegment) = 0 then
  378.         set the castNum of sprite (pRotateSprite + (buttonSegment - 1)) = pFirstToolOff + (buttonSegment - 1)
  379.       else  set the castNum of sprite (pRotateSprite + (buttonSegment - 1)) = pFirstAnimTool + ((buttonSegment - 1) * 9)
  380.       
  381.       set the castnum of sprite pRollOverHiliteSprite =  (pFirstHiliteBtn + buttonSegment) -1
  382.       
  383.     end if
  384.     set pWhichBtnOver = buttonSegment  -- save previous tool button over
  385.     
  386.   else
  387.     
  388.     if (pWhichBtnOver <> #none) and  (pWhichBtnOver < 7 ) then
  389.       set the castNum of sprite (pRotateSprite + (pWhichBtnOver - 1)) = pFirstAnimTool + ((pWhichBtnOver - 1) * 9)
  390.     end if
  391.     
  392.     set the member of sprite pRollOverHiliteSprite = pSpritePlaceMem
  393.     set pWhichBtnOver = #none
  394.     
  395.   end if
  396.   
  397. end
  398. ----------------------------------------------------------------------------ò
  399. on mClearBtnHilites me
  400.   
  401.   set the member of sprite pRollOverHiliteSprite = pSpritePlaceMem
  402.   set the member of sprite pGlobalBtnOnSprite =  pSpritePlaceMem
  403.  
  404.   if (pWhichBtnOver <> #none)  and  (pWhichBtnOver < 7 ) then
  405.     set the castNum of sprite (pRotateSprite + (pWhichBtnOver - 1)) = pSpritePlaceMem
  406. end if
  407.   updatestage
  408.   
  409. end mClearBtnHilites
  410. ----------------------------------------------------------------------------ò
  411. on mInterfaceBtnHit me                                                                        -- takes action based on currently highlighted button
  412.   
  413.   
  414.   if (pWhichBtnOver  <> #none) then
  415.     
  416.     
  417.     mClearBtnHilites (me)
  418.     
  419.     if (pWhichBtnOver < pGlobalBtnRelFirstCast) then
  420.       
  421.       
  422.       set availbutton = getat(pAvailableBtnList,pWhichBtnOver)
  423.       if availbutton then mActivateTool (me, pWhichBtnOver)        -- tool btns
  424.       
  425.       
  426.     else if (pWhichBtnOver = pGlobalBtnRelFirstCast) then 
  427.       mQuitBtnHit (me)                         -- quit button
  428.     else mDoGlobalBtnAction (me, pWhichBtnOver)
  429.     
  430.     
  431.   end if
  432.   
  433. end mInterfaceBtnHit
  434.  
  435. ----------------------------------------------------------------------------ò
  436. on mQuitBtnHit me
  437.   
  438.   mClearMyPuppets me
  439.   mHideQTVR me 
  440.   go "credits.dir"
  441.   
  442. end
  443. ----------------------------------------------------------------------------ò
  444. on mGoInvestigation me
  445.   
  446.   if objectp(gActiveInvObj) then
  447.     mclose( gActiveInvObj )
  448.     set gActiveInvObj = empty
  449.   end if
  450.   
  451.   if (the moviename <> "INVEST.DIR") then 
  452.     
  453.     go  "INVEST.DIR"
  454.     
  455.   else 
  456.     
  457.     if objectp( gActiveInvObj ) then mclose ( gActiveInvObj )
  458.     set gActiveInvObj = empty
  459.     
  460.     go "Investigations"
  461.     mActivate ( me )
  462.     
  463.   end if
  464.   
  465. end mGoInvestigation
  466. ----------------------------------------------------------------------------ò
  467. on mDoGlobalBtnAction me, whichBtn
  468.   
  469.   mPlaySndEffect (gUtilityObj, pButtonSnd ) 
  470.   updatestage
  471.   
  472.   if (pActiveTool <> EMPTY) then mTurnOffTool (me)
  473.   set the castNum of sprite pGlobalBtnOnSprite = pFirstGlobalBtnOn + (whichBtn - pGlobalBtnRelFirstCast )
  474.   updateStage
  475.   
  476.   if (whichBtn = pGlobalBtnRelFirstCast + 8) then    --Journal
  477.     
  478.     if mAtBYS( gJournalObj) then mActivate(gJournalObj)
  479.     else mClearBtnHilites ( me )
  480.     
  481.   else
  482.     
  483.     if (whichBtn = pGlobalBtnRelFirstCast) then 
  484.       mResetInterface me
  485.       go "credits.dir"
  486.     else if (whichBtn = pGlobalBtnRelFirstCast + 1) then 
  487.       mResetInterface me
  488.       go "help.dir"
  489.     else if (whichBtn = pGlobalBtnRelFirstCast + 2) then 
  490.       mResetInterface me
  491.               set gInventorIndexNum = 4
  492.       mChangeInventor (me, #GAllery)
  493.     else if (whichBtn = pGlobalBtnRelFirstCast + 3) and (the movie <> "Bell.dir") then
  494.       
  495.       if ((gAvailbleInv = #Bell) or (gAvailbleInv = #All)) then 
  496.         mResetInterface me
  497.         set gInventorIndexNum = 2
  498.         mChangeInventor (me, #Bell)
  499.       else 
  500.         set the member of sprite pGlobalBtnOnSprite = member "HBELL.PIC"
  501.         updateStage
  502.         mVRHSaction (me, 102)
  503.       end if
  504.       
  505.     else if (whichBtn = pGlobalBtnRelFirstCast + 4) and (the movie <> "Edison.dir") then 
  506.       
  507.       if ((gAvailbleInv = #Edison) or (gAvailbleInv = #All))  then 
  508.         mResetInterface me
  509.         set gInventorIndexNum = 1
  510.         mChangeInventor (me, #Edison)
  511.       else 
  512.         set the member of sprite pGlobalBtnOnSprite = member "HEDISON.PIC"
  513.         updateStage
  514.         mVRHSaction (me, 100)
  515.       end if
  516.       
  517.     else  if (whichBtn = pGlobalBtnRelFirstCast + 5) and (the movie <> "Watt.dir") then
  518.       
  519.       if ((gAvailbleInv = #Watt) or (gAvailbleInv = #All)) then
  520.         mResetInterface me
  521.         set gInventorIndexNum = 3
  522.         mChangeInventor (me, #Watt)
  523.       else
  524.         set the member of sprite pGlobalBtnOnSprite = member "HWATT.PIC"
  525.         updateStage
  526.         mVRHSaction (me, 101)
  527.       end if
  528.       
  529.     else  if (whichBtn = pGlobalBtnRelFirstCast + 6) then 
  530.       mResetInterface me
  531.       mGoInvestigation( me )
  532.     else if (whichBtn = pGlobalBtnRelFirstCast + 7) then 
  533.       mResetInterface me
  534.       go "TIMELN.DIR"
  535.     end if
  536.     
  537.     patchpal
  538.     
  539.   end if
  540.   
  541. end mDoGlobalBtnAction
  542. ----------------------------------------------------------------------------------------------------------------ò
  543. on mResetInterface me
  544.   
  545.   mClearMyPuppets me
  546.   set pActive = FALSE 
  547.   mHideQTVR me 
  548.   
  549.   sound stop 1
  550.   sound stop 2
  551.   set gActiveAmbSnd = 0
  552.   patchpal
  553.   
  554.   if objectp( gActiveInvObj ) then mclose ( gActiveInvObj )
  555.   if objectp( gActiveFunctionObj ) then mclose( gActiveFunctionObj )
  556.   puppetsprite pPictSprite, False
  557.   mClearText (me) 
  558.   
  559. end mResetInterface
  560. ----------------------------------------------------------------------------------------------------------------ò
  561. on mSetInventor me, whichInventor
  562.   
  563.   set pCurrentInventor = whichInventor
  564.   set pHSobjIndexedLst =  getaprop( pInvHsObjLst, whichInventor)
  565.   
  566.   mChangeInventor( gAreaManagerObj )
  567.   mReSetMode(gModeManager, #QTVR)
  568.   
  569. end mSetInventor
  570. ----------------------------------------------------------------------------------------------------------------ò
  571. on mChangeInventor me, whichInventor
  572.   
  573.   set InventorFilename =  getaprop(pInvenFilenameLst,whichInventor)
  574.   set pCurrentInventor = whichInventor
  575.  
  576.   set pHSobjIndexedLst =  getaprop( pInvHsObjLst, whichInventor)
  577.   mChangeInventor( gAreaManagerObj )
  578.   mReSetMode(gModeManager, #QTVR)
  579.   mClose( pQTVRobj )
  580.   go  InventorFilename
  581.   
  582. end mChangeInventor
  583. ----------------------------------------------------------------------------------------------------------------ò
  584. on mActivateInventor me
  585.   
  586.   
  587.   if (gInventorIndexNum <> 4 ) then  set pToolsActive = TRUE
  588.   cursor 4
  589.   set gActiveAmbSnd =  getat( ["EAMBIENT.AIF","BAMBIENT.AIF","WAMBIENT.AIF","GALLERY.AIF"], gInventorIndexNum )
  590.   mPlayAmbient( gUtilityObj )
  591.   mUpdateReturnFrame (gUtilityObj)
  592.   set pHSobjIndexedLst =  getaprop( pInvHsObjLst, pCurrentInventor)
  593.   set pCurrentQTVR = getaProp( pQTVRmovieList, pCurrentInventor )
  594.   set pInitialQTVRcords = getaprop( pInitialQTVRlst, pCurrentInventor)
  595.   mSetToolBtns (me, #QTVR)
  596.   mReSetMode(gModeManager, #QTVR)
  597.   mOpen (pQTVRobj, pCurrentQTVR, pInitialQTVRcords,2)
  598.   
  599. end mActivateInventor
  600. ----------------------------------------------------------------------------------------------------------------ò
  601. on mToolMenuClicked me
  602.   
  603.   mDenyClicks( gUtilityObj )
  604.   mPlaySndEffect (gUtilityObj, the number of cast "ToolButn.aif") 
  605.   updatestage
  606.   mButtonClicked ( pActiveTool )
  607.   
  608. end mToolMenuClicked
  609. ----------------------------------------------------------------------------------------------------------------ò
  610. on mTurnOffTool me
  611.   
  612.   -- remove from active button list
  613.   set pActiveTool = EMPTY
  614.   
  615.   -- reset sprites to normal interface
  616.   set the castNum of sprite pToolWinHiliteSprite = pSpritePlaceMem
  617.   set the castNum of sprite pToolWindowSprite = pSpritePlaceMem
  618.   --set the castNum of sprite pActiveHiliteSprite = pSpritePlaceMem
  619.   
  620.   repeat with toolCounter = 0 to pToolCount - 1
  621.     if getAt(pAvailableBtnList, toolCounter + 1) = 1 then set the castNum of sprite (pRotateSprite + toolCounter) = pSpritePlaceMem
  622.   end repeat
  623.   
  624. end
  625. ----------------------------------------------------------------------------------------------------------------ò
  626. on mDisplayText me, WhatHS
  627.   
  628.   
  629.   if not (listp(pHSobjIndexedLst)) or (WhatHS > 50) then exit
  630.   
  631.   if (WhatHS <> pCurrentHStext) then
  632.     set pCurrentHStext = WhatHS
  633.     
  634.     if (WhatHS = 0) then  mClearText (me) 
  635.     else 
  636.       
  637.       set the text of cast pLabelTxtCast = mGetLabel ( getprop(pHSobjIndexedLst,WhatHS))
  638.       set the text of cast pDescriptionTxtCast = mGetDescription ( getprop(pHSobjIndexedLst,WhatHS))
  639.       set the text of cast pInstructionTxtCast = " "
  640.       
  641.     end if
  642.     
  643.   end if
  644.   
  645. end mDisplayText
  646. ----------------------------------------------------------------------------------------------------------------ò
  647. on mDisplayClickText me, WhatHS
  648.   
  649.   if gInventorIndexNum = 4 then
  650.     
  651.     if gAvailbleInv <> #ALL then
  652.       set argTopSpriteNum = 25
  653.       puppetsprite argTopSpriteNum, true
  654.       case gAvailbleInv of
  655.         #Bell:  set the member of sprite argTopSpriteNum = member "BELL GALLERY BUY.PIC"
  656.         #Watt:  set the member of sprite argTopSpriteNum = member "WATT GALLERY BUY.PIC"
  657.         #Edison: set the member of sprite argTopSpriteNum = member "EDISON GALLERY BUY.PIC"
  658.       end case
  659.     end if
  660.     
  661.   else
  662.     set the text of cast pDescriptionTxtCast = " " 
  663.     set the text of cast pLabelTxtCast = mGetLabel ( getprop(pHSobjIndexedLst,WhatHS))
  664.     set the text of cast pInstructionTxtCast = mGetInstruction ( getprop(pHSobjIndexedLst,WhatHS))
  665.   end if
  666.   
  667. end mDisplayClickText
  668. ----------------------------------------------------------------------------------------------------------------ò
  669. on mClearText me
  670.   
  671.   -- clear text
  672.   set the text of cast pLabelTxtCast = " "
  673.   set the text of cast pDescriptionTxtCast = " " 
  674.   set the text of cast pInstructionTxtCast = " "
  675.   
  676. end mClearText
  677. ----------------------------------------------------------------------------------------------------------------ò
  678. on mDelay me, numOfTicks
  679.   
  680.   set endTime = the ticks + numOfTicks
  681.   repeat while (the ticks < endTime)
  682.   end repeat
  683.   
  684. end mDelay
  685. ----------------------------------------------------------------------------------------------------------------ò
  686. on mShowQTVR me
  687.   
  688.   cursor 4
  689.   mDenyClicks( gUtilityObj )
  690.   mUpdateReturnFrame(gUtilityObj)
  691.   mShow( pQTVRobj )
  692.   set gActiveAmbSnd =  getat(["EAMBIENT.AIF","BAMBIENT.AIF","WAMBIENT.AIF","GALLERY.AIF"],gInventorIndexNum)
  693.   mPlayAmbient( gUtilityObj )
  694.   mSetToolBtns me, (#QTVR)
  695.   
  696. end mShowQTVR
  697. ----------------------------------------------------------------------------------------------------------------ò
  698. on mHideQTVR me  
  699.   
  700.   mDenyClicks( gUtilityObj )
  701.   mClearToolMenu ( me )
  702.   mSetToolBtns (me, #NONE)
  703.   mHide( pQTVRobj ) 
  704.   
  705. end mHideQTVR
  706. ----------------------------------------------------------------------------------------------------------------ò
  707. on mVRHSaction me, sHS
  708.   
  709.   mDistributeHS( gAreaManagerObj, sHS )
  710.   
  711. end mVRHSaction
  712. ----------------------------------------------------------------------------------------------------------------ò